package br.ufes.cwtools.gw.android.connection_service;

import br.ufes.cwtools.gw.android.connection_service.IConnectionServiceCallback;

interface IConnectionService {
	void setLoginData(in String url, in String username, in String password);
	
	/**
	 * Retrieves a file from given URL and stores in the local filesystem.
	 * The location is then returned using the callback provided.
	 * Optionally, tries to retrive the file from a local cache.
	 * @param url URL to retrive the file
	 * @param callback callback interface which will be called to return the file location
	 * @param requestor identifies the entity performing this request
	 * @param allowCache indicates whether the cache should be used to fulfill this request
	 * @return id which can be used to identify the request at the callback
	 */
	int registerGetRequest(in String url, in String requestor, in String id,
			in boolean allowCache, in IConnectionServiceCallback callback);
	
	int registerPostRequest(in String url, in String requestor, in String id,
			in Bundle stringParts, in Bundle fileParts,
			in IConnectionServiceCallback callback);
	
	void unregister(in String requestor, in String id);
	
	void unregisterAll(in String requestor);
}